import Vue from 'vue';
import axios from './router/axios';
import VueAxios from 'vue-axios';
import App from './App';
import router from './router/router';
import './permission'; // 权限
import './error'; // 日志
import './cache'; //页面缓存
import store from './store';
import {
	loadStyle
} from './util/util'
import {
	dateFormat
} from './util/date'
import * as urls from '@/config/env';
import Element from 'element-ui';
//  wps
import * as WPS from './static/jwps.es6'
Vue.prototype.wps = WPS;
import MyPrint from '@/util/print' // 引入附件的js文件
Vue.use(MyPrint) // 注册

import {
	iconfontUrl,
	iconfontVersion
} from '@/config/env';
import i18n from './lang'; // Internationalization
import './styles/common.scss';
import '../public/cdn/iconfont/saber/iconfont.css';
import 'font-awesome/css/font-awesome.min.css'
import avueUeditor from 'avue-plugin-ueditor';
import website from '@/config/website';
import crudCommon from '@/mixins/crud';
import mixin from './mixins/index';
import creatMixin from './mixins/creat';
import gComponents from './util/components'

// 业务组件
import tenantPackage from './views/system/tenantpackage';
Vue.use(gComponents)
import AFTableColumn from 'af-table-column'
Vue.use(AFTableColumn)

// 注册全局crud驱动
window.$crudCommon = crudCommon;
// 加载Vue拓展
Vue.use(router);
Vue.use(VueAxios, axios);
Vue.mixin(mixin),
	Vue.mixin(creatMixin)
Vue.use(Element, {
	i18n: (key, value) => i18n.t(key, value)
});
Vue.use(window.AVUE, {
	size: 'small',
	tableSize: 'small',
	calcHeight: 65,
	i18n: (key, value) => i18n.t(key, value)
});
// 加载相关url地址
Object.keys(urls).forEach(key => {
	Vue.prototype[key] = urls[key];
});
const height = window.innerHeight
Vue.prototype.$height = height
// 加载website
Vue.prototype.website = website;
Vue.prototype.dateFormat = dateFormat;
// 动态加载阿里云字体库
iconfontVersion.forEach(ele => {
	loadStyle(iconfontUrl.replace('$key', ele));
});

Vue.config.productionTip = false;

new Vue({
	router,
	store,
	i18n,
	render: h => h(App)
}).$mount('#app');
